<template>
	<view class="set_box">
		<uv-textarea v-model="keyword" placeholder="请输入个人简介" :textStyle="textStyle" customStyle="margin: 0rpx;padding:0;"
			height="200" :count="true"></uv-textarea>
		<view class="set_btn" @click="handleSave">保存个人简介</view>
	</view>
</template>

<script setup>
import { ref } from 'vue';
import { onLoad } from '@dcloudio/uni-app';
import api from '../../common/api';
import { useUserinfoStore } from '@/stores/userInfo';
const userInfo_Store = useUserinfoStore();
const keyword = ref('')
onLoad((options) => {
	keyword.value = options.key
})
const textStyle = {
	background: '#F6F6F6',
	padding: '20rpx'
}
const handleSave = async () => {
	if (!keyword.value) {
		return uni.showToast({
			title: '请输入个人简介',
			icon: 'none'
		})
	}
	const res = await api.UpdateModifyintroduce_API({ keyword: keyword.value })
	if (res.code === 0) {
		uni.showToast({
			title: '修改成功',
			icon: 'none'
		})
		//获取用户信息
		await userInfo_Store.GetUserInfo();
		uni.navigateBack()
	}
}
</script>
<style lang="scss" scoped>
.set_box {
		border-top: 24rpx solid #f5f5f5;
		padding: 40rpx 24rpx 24rpx;
		// text-align: left;
}
.set_btn {
	position: fixed;
	bottom: 24rpx;
	left: 24rpx;
	width: calc(100% - 48rpx);
	height: 68rpx;
	background-color: #7F7FE9;
	color: #fff;
	text-align: center;
	line-height: 68rpx;
	border-radius: 16rpx;
}
</style>
